﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using notepadplus.Dialogs.Logs;

namespace notepadplus.Dialogs.Execute
{
    public partial class ExecWithProto : Form
    {
        public ExecWithProto()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Process.Start(Application.StartupPath + "\\config\\protocols-exec.txt");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            locateProgramDialog.ShowDialog(this);
        }

        private void locateProgramDialog_FileOk(object sender, CancelEventArgs e)
        {
            prgpath.Text = locateProgramDialog.FileName;
        }

        private void executeButton_Click(object sender, EventArgs e)
        {
            // Test if program path allowed
            if (prgpath.Text == "")
            {
                MessageBox.Show("You didn't have entered the path to the program!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                if (execo.Checked == true)
                {
                    // TODO: locate protocols
                    LogWindow lgw = new LogWindow();
                    lgw.Show();
                }
                else
                {
                    // TODO: start program with current files and locate protocols
                }
            }
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
